<template>
    <el-dialog title="新增工单" v-model="visible" width="50%">
      <el-form :model="form" label-width="120px">
        <el-form-item label="工单号">
          <el-input v-model="form.workOrderNo"></el-input>
        </el-form-item>
        <el-form-item label="工单类型">
          <el-select v-model="form.workOrderType" placeholder="请选择工单类型">
            <el-option label="类型1" value="type1"></el-option>
            <el-option label="类型2" value="type2"></el-option>
          </el-select>
        </el-form-item>
        <!-- 添加更多表单项 -->
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="cancel">取消</el-button>
          <el-button type="primary" @click="confirm">确定</el-button>
        </span>
      </template>
    </el-dialog>
  </template>
  
  <script setup>
  import { defineProps ,defineEmits} from 'vue'
  
  const props = defineProps({
    visible: Boolean
  })
  
  const emit = defineEmits(['update:visible', 'add'])
  
  const form = reactive({
    workOrderNo: '',
    workOrderType: ''
  })
  
  const cancel = () => {
    emit('update:visible', false)
  }
  
  const confirm = () => {
    emit('add', { ...form })
    emit('update:visible', false)
  }
  </script>